package com.example.leetcode.array;

class Solution6457 {
    public String removeTrailingZeros(String num) {
        int temp = 0;
        for (int i = num.length() - 1; i >= 0; i--) {
            if (num.charAt(i) != '0') {
                temp = i;
                break;
            }
        }
        return num.substring(0, temp + 1);
    }
}

public class leetcode6457 {
    public static void main(String[] args) {
        Solution6457 solution6457 = new Solution6457();
        System.out.println(solution6457.removeTrailingZeros("51230100"));
        System.out.println(solution6457.removeTrailingZeros("512"));
    }
}
